<template>
  <div class="loading" v-show="showLoading">
    <div class="container">
      <img src="@/assets/images/loading.gif" alt="加载中" />
      <div class="text">loading...</div>
    </div>
  </div>
</template>
<script>
export default {
  name: "Loading-index",
  data() {
    return {
      showLoading: false,
    };
  },
  methods: {
    show() {
      this.showLoading = true;
    },
    hidden() {
      this.showLoading = false;
    },
  },
};
</script>
<style lang="less" scoped>
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  z-index: 1000000;
  .container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    img {
      width: 100px;
    }
    .text {
      font-size: 25px;
      color: rgba(0, 0, 0, 0.65);
    }
  }
}
</style>
